<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="model.*" %>
<%@ page import="java.util.*" %>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0, user-scalable=no" />
	<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
	<link rel="Stylesheet" href="css/bootstrap-responsive.min.css" />
	<link rel="stylesheet" href="css/questudy.css" />
	
	<script src="http://code.jquery.com/jquery.js"></script>
	<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
	<script src="js/study/quest.js"></script>
<title>Show Answer</title>
</head>
<%
	int studyId = ((Integer)request.getAttribute("studyId")).intValue();
	int questId = ((Integer)request.getAttribute("questId")).intValue();
	Answer ans = (Answer)request.getAttribute("answer");
	ArrayList<FeedBack> feedBackList = null;
	if(request.getAttribute("feedBackList") == null)
		feedBackList = new ArrayList<FeedBack>();
	else 
		feedBackList = (ArrayList<FeedBack>)request.getAttribute("feedBackList"); 
%>
<body>
	<jsp:include page="nav/nav_main.jsp"></jsp:include>
	<jsp:include page="nav/nav_study.jsp"></jsp:include>
	<div class="contaner">
		<div class="col-sm-6 col-sm-offset-3 firstDiv">
			<div class="row">
				<div class="col-xs-6"><small>작성자: <%=ans.getMemid() %></small></div>
				<div class="col-xs-6"><small>수행시간: <%=ans.getCreatedTime() %></small></div>
			</div>
			<div class="input-group">
				<span class="input-group-addon">퀘스트 답변</span>
				<textarea class="form-control" name="content" rows="10"><%=ans.getContent() %></textarea>
			</div>
			<ul class="list-group">
				<%for(FeedBack feed : feedBackList) { %>
				<%if(feed.getAid() == ans.getAnswerId()) {%>
					<li class="list-group-item"><span>작성자 : <%=ans.getMemid() %>&nbsp;&nbsp;&nbsp;</span><%=feed.getContent() %></li>
				<%}} %>
			</ul>
			
			<form action="NewFeedBack.Answer?studyId=<%=studyId%>&questId=<%=questId%>&answerId=<%=ans.getAnswerId()%>" method="POST">
			<input type="hidden" name="targetId" value="<%=ans.getUid()%>">
			<div class="input-group">
		      <input type="text" name="content" class="form-control">
		      <span class="input-group-btn">
		        <button type="submit" class="btn btn-default">피드백하기</button>
		      </span>
		    </div><!-- /input-group -->
			</form>
			
		</div>
	</div>
</body>
</html>